package view.ui
{
	import events.MyEvent;
	
	import flash.display.Bitmap;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;

	public class PathStick extends Sprite
	{
		[Embed(source="/asset/folder_info.png")]
		private var _bg_jpg:Class;
		private var bg_jpg:Bitmap;
		
		private var reelection:PngBt;
		private var path:PathTextField;
		public function PathStick()
		{
			super();
			init();
		}
		
		private function init():void
		{
			bg_jpg=new _bg_jpg() as Bitmap;
			this.addChild(bg_jpg);
			reelection=new PngBt("re");
			this.addChild(reelection);
			reelection.x=bg_jpg.width-reelection.width-20;
			reelection.y=3;
			reelection.addEventListener(MouseEvent.CLICK,handleBtClick);
			this.addEventListener(Event.REMOVED_FROM_STAGE,handleRemovedFromStage);
			path=new PathTextField();
			path.x=10;
			path.y=20;
			this.addChild(path);
		}
		
		public function set url(s:String):void
		{
			path.text=s;
		}
		
		private function handleBtClick(e:MouseEvent):void
		{
			this.dispatchEvent(new MyEvent("reChose"));
		}
		
		private function handleRemovedFromStage(e:Event):void
		{
			reelection.removeEventListener(MouseEvent.CLICK,handleBtClick);
			this.removeEventListener(Event.REMOVED_FROM_STAGE,handleRemovedFromStage);
		}
	}
}